using UnityEngine;
using System.Collections;

public class Monster_Attack_State : State {
	
	
	public override void Enter_State(Alive_object _monster_script)
	{
		animation.Play("attack");
	}
	public override void Excute_State(Alive_object _monster_script)
	{
		
		if( Vector3.Distance(GameManager.getInstance().TargetObject.transform.position
							, transform.position) > _monster_script.monster_data_.attack_range )
		{
			_monster_script.fsm.Change_state(_monster_script.arr_state_[0],_monster_script);
		}
		
		if(animation.IsPlaying("attack").Equals(false))
		{
			GameManager.getInstance().TargetObject.GetComponent<ProtectedObject>().DamagedProtect(_monster_script.monster_data_.attack_damage);
			animation.Play("attack");
		}
	}
	public override void Exit_State(Alive_object _monster_script)
	{
	}
}
